<template>
	<view class="cu-card article">
		<view class="cu-item shadow">
			<view class="title solid-bottom">
				<view class="text-cut">
					<slot></slot>
				</view>
			</view>
			<view>
				<round :Obj="Obj.items"></round>
			</view>
			<view class="padding-sm flex">
				<view class="flex-sub" v-for="(item,index) in items" :key="index">
					<cell :item="item" ></cell>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	import _data from './data.js'
	import round from './round.vue'
	import cell from './cell.vue'
	export default {
		components: {
			round,
			cell
		},
		data() {
			return {
				items: [{
						'label': '考试时间',
						'content': '2019/2/1'
					},
					{
						'label': '整体表现',
						'content': '4A 1T'
					}
				]
			}
		},
		props: {
			Obj: Object
		},
		watch: {
			Obj: function(val) {
				var o = {}
				for (var item of val.items) {
					var level = item.level;
					if (o[level]) {
						o[level]++
					} else {
						o[level] = 1;
					}
				}
				var content = [];
				for (var a in o) {
					content.push(o[a] + a)
				}
				this.items = [{'label':'整体表现','content': content.join(' ')},{'label':'考试结果','content':val.result}]
			}
		},
		created() {

			// console.info(_data.data.dataSource.data)
		}
	}
</script>

<style>
</style>
